package com.linktel.productionLine.service;

import com.linktel.productionLine.common.BaseResponse;
import com.linktel.productionLine.dao.ProcessYieldDao;
import com.linktel.productionLine.dao.WorkOrderDao;
import com.linktel.productionLine.entity.dto.productionYield.ProductionYieldDTO;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;


/**
 * 对工序base_step的操作
 *
 * @Author HuangJiaHui
 * @Date 2023/8/25 10:26
 */
@Service
@AllArgsConstructor
public class ProductYieldService {

    private WorkOrderDao workOrderDao;
    private ProcessYieldDao processYieldDao;


    public List<ProductionYieldDTO> listProductionYieldDTO() {
        List<ProductionYieldDTO> productionYieldDTOS = workOrderDao.listWorkOrder();
        productionYieldDTOS.forEach(item -> {
            item.setProcessYieldDTOList(processYieldDao.listByWOrkOrderId(item.getId()));
        });
        return productionYieldDTOS;
    }
}
